<script lang="ts" setup>
import { ref } from 'vue'
import { Menu, HomeFilled, Message ,CaretBottom, Avatar} from '@element-plus/icons-vue'
import { contains } from 'jquery'
import { getUserinfoServer } from '@/api/user.js'
import useUserInfo from '@/stores/userinfo.js'
import router from '@/router'


const useuserinfo = useUserInfo() as any;
const getUserinfo = async()=>{
    let result = await getUserinfoServer();
    useuserinfo.setInfo(result.data);
}
getUserinfo();




</script>


<template>
    <el-container class="managerhome">
        <el-aside width="200px">
            <div class="el-aside-logo"></div>
            <el-menu class="el-menu-1" active-text-color="#1E90FF" text-color="	#000000" router>
                <el-sub-menu>
                    <template #title>
                        <el-icon>
                            <Menu />
                        </el-icon>
                        <span>信息管理</span>
                    </template>
                    <el-menu-item-group>
                        <el-menu-item index="/info/shicimg"><span>诗词管理</span></el-menu-item>
                        <el-menu-item index="/info/authormg"><span>作者管理</span></el-menu-item>
                        <el-menu-item index="/info/activemg"><span>活动管理</span></el-menu-item>
                        <el-menu-item index="/info/usermg"><span>用户管理</span></el-menu-item>
                        <el-menu-item index="/info/sectionmg"><span>版块管理</span></el-menu-item>
                        <el-menu-item index="/info/mainpostmg"><span>主贴管理</span></el-menu-item>
                        <el-menu-item index="/info/replypostmg"><span>回复贴管理</span></el-menu-item>
                    </el-menu-item-group>
                </el-sub-menu>
                <el-sub-menu>
                    <template #title>
                        <el-icon>
                            <HomeFilled />
                        </el-icon>
                        <span>账号资料</span>
                    </template>
                    <el-menu-item-group>
                        <el-menu-item index="/user/userinfo"><span>个人信息</span></el-menu-item>
                        <el-menu-item index="/user/repassword"><span>修改密码</span></el-menu-item>
                    </el-menu-item-group>
                </el-sub-menu>
                <el-menu-item>
                    <el-icon>
                        <Message />
                    </el-icon>
                    <template #title>审核反馈</template>
                </el-menu-item>
            </el-menu>
        </el-aside>
        <el-container>
            <el-header >
                <div>后台管理员:<strong>{{ useuserinfo.info.nickname }}</strong></div>
                <el-dropdown>
                    <span class="el-dropdown-link">
                        <el-icon>
                            <Avatar/>
                        </el-icon>
                        <el-icon class="el-icon--right">
                            <CaretBottom />
                        </el-icon>
                    </span>
                    <template #dropdown >
                        <el-dropdown-menu>
                            <el-dropdown-item index="/user/userinfo">个人信息</el-dropdown-item>
                            <el-dropdown-item index="/user/repassword">修改密码</el-dropdown-item>
                        </el-dropdown-menu>
                    </template>
                </el-dropdown>
            </el-header>
            <el-main>
                <router-view></router-view>
            </el-main>
            <el-footer>
                <div>诗词文化交流平台管理端</div>
            </el-footer>
        </el-container>
    </el-container>
</template>

<style lang="scss" scoped>
.managerhome {
    height: 100vh;

    .el-aside {
        background-color: #F1F1F1;

        &-logo {
            height: 120px;
            background: url('@/assets/logo.png') no-repeat center / 120px auto;
            background-color: #F1F1F1;
        }

        .el-menu {
            border-right: none;
            background-color: #F1F1F1;
        }
    }

    .el-header {
        background-color: #fff;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .el-dropdown__box {
            display: flex;
            align-items: center;

            .el-icon {
                color: #999;
                margin-left: 10px;
            }

            &:active,
            &:focus {
                outline: none;
            }
        }
    }

    .el-main {
        background-color:	#F0F8FF;
    }

    .el-footer {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 17px;
        color: #0f0f0e;
    }

}
</style>
